import { GET_TUIJIAN_DATA, GET_MIAOSHA_DATA, GET_SWIPER_DATA, GET_LIST_DATA, ITEM_OBJ_DATA } from '../content'
import axios from 'axios'
export function fetchMainData() {
    return dispatch => {
        console.log(111);
        axios.post("https://srv.hotkidceo.com/appapi/api/root-ceo-content/hpPageConfigure/pageList", { "channelId": null, "memberKey": "" }
        ).then(res => {
            dispatch({
                type: GET_MIAOSHA_DATA, data: res.data.data[5]
            });
            dispatch({
                type: GET_SWIPER_DATA, data: res.data.data[1].configureAttribute
            });
            dispatch({
                type: GET_LIST_DATA, data: res.data.data[2].configureAttribute,
            });
        })
        axios.post("https://srv.hotkidceo.com/appapi/root-ceo-commodity/commodityApi/commodityByBigData", { "page": 1, "isWholeSale": 0, "channelId": "C06022632001", "memberKey": 33214168 }).then(
            (res) => {
                dispatch({
                    type: GET_TUIJIAN_DATA, data: res.data.data.templateList
                });
            }
        )
    }
}
export function fetchItemData(id) {
    console.log("fetchItemData", id);
    return dispatch => {
        console.log("dispatch-28");
        axios.post('https://srv.hotkidceo.com/appapi/root-ceo-commodity/commodityApi/commodityDetail', { "ptKey": id, "memberKey": "", "isWholeSale": 0, "channelId": null })
            .then(
                (res) => {
                    dispatch({ type: ITEM_OBJ_DATA, data: res.data.data.templateInfo })
                }
            )
    }
}